<div class="content last ui-widget-content">
	<div class="content-full">
		<div style="width: 98%;padding-left: 5px;">
			<?php if (count($this->arrError)>0) echo $this->error($this->arrError); ?>
			<div id="create-question">
				<div class="cms_table">
					<h2>Loại câu hỏi : <?php echo $this->nameTypeQuestion; ?></h2>
					<form action="<?php echo BASE_URL; ?>/question/<?php echo $this->action;?>"	method="POST" name="question-form" id="question-form">
						<input type="hidden" name="type" id="type" value="<?php echo $this->ObjQuestion['type'];?>">
						<input type="hidden" name="id" value="<?php echo $this->ObjQuestion['id'] ;?>">		
						<input type="hidden" name="isupdate" value="<?php echo $this->ObjQuestion['isupdate'];?>"/>
						<input type="hidden" name="created_user" value="<?php echo $this->ObjQuestion['created_user'];?>"/>			
						<table cellpadding="0" cellspacing="0">
							<tr><td class="label">
									Chọn môn học: 
									</td><td class="field_container"><?php echo $this->SltSubject("subject_id", $this->ObjQuestion['subject_id'],$this->arrSubjectId); ?>
							</td></tr>
							<tr><td class="label">
									Chọn chủ đề môn học:
									</td><td class="field_container">
									<span class="chapter_id">
										<?php echo $this->SltChapterSubject("chapter_id", $this->ObjQuestion['chapter_id'],$this->ObjQuestion['subject_id']); ?>
									</span><p class="chapterSubject_description"></p>
							</td></tr>
							<tr><td class="label">
										Tiêu đề câu hỏi:  
								</td><td class="field_container">
								<textarea style="font-size: 16px;font-weight: 600;" name="question_title" rows="3" cols="20"><?php echo $this->ObjQuestion['question_title'];?></textarea>
							</td></tr>
							<tr><td colspan="3">
									 <label><b> Nội dung câu hỏi:</b> </label><br />
									<textarea id="question-editor" class="question-editor" name="content" rows="8" cols="20"><?php echo $this->ObjQuestion['content']; ?></textarea>
							</td></tr>
							<tr><td colspan="3">
										<label><b> Giải thích cho câu trả lời:</b> </label><br />
										<textarea class="editor" id="generalfeedback" name="generalfeedback" rows="3" cols="20"><?php echo $this->ObjQuestion['generalfeedback'];?></textarea>
							</td></tr>
							<tr><td class="label">
										Độ khó:
										</td><td class="field_container">
										<?php echo $this->SltLevel("level",$this->ObjQuestion['level']); ?>
							</td></tr>
							<tr><td class="label">
										Điểm mặc định cho câu hỏi:
										</td><td class="field_container">
										<input onchange="validateNum(this); return false;" type="text" name="score" value="<?php  echo $this->ObjQuestion['score']; ?>" >
										
							</td></tr>
							<?php if( $this->ObjQuestion['isupdate'] == 1){ ?>
							<tr><td class="label">
										Ngày tạo:
										</td><td class="field_container"><input type="text" name="timecreated" size="40" readonly="readonly" value="<?php  echo Zend_View_Helper_FormatDate::convertYmdToMdy($this->ObjQuestion['timecreated']); ?>" >
							</td></tr>
							<tr><td class="label">
										Ngày chỉnh sửa gần nhất:
										</td><td class="field_container"><input type="text" name="timemodified" size="40" readonly="readonly" value="<?php  echo Zend_View_Helper_FormatDate::convertYmdToMdy($this->ObjQuestion['timemodified']); ?>" >
							</td></tr>
							<?php } ?>						
							<tr><td class="label">
										Không cho sinh viên thực hành câu này:
										</td><td class="field_container"><input type="checkbox" name="hidden" <?php if($this->ObjQuestion['hidden']=='on') echo "checked"; ?> >
							</td></tr>
	
							
							<tr><td colspan="5"  style="background-color: #4E8EDF; font-size: 15px; color: white; font-family: tahoma;"  >
									<p align="center">
										<label class="title-info-ans-question">ĐIỀN THÔNG TIN CHO CÂU TRẢ LỜI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										</label>  
									</p>
							</td></tr>
							<tr><td colspan="3">
									<div class="answer-box ui-state-default">
										<input type="hidden" name="ansID[]" value="<?php echo $this->ObjQuestion['ansID']; ?>">
										<table>
											<tr>
												<td colspan="2">
													<textarea id="ans_0" class="editor" name="ans[]" cols="20" rows="2"><?php echo $this->ObjQuestion['answer_content'];?></textarea>												
												</td>
											</tr>
											<tr>
												<td colspan="2">
													<label>Phản hồi cho câu trả lời</label>
													<textarea  name="feedback[]" rows="3" cols="20"><?php echo $this->ObjQuestion['feedback'];?></textarea>
												</td>
											</tr>								
										</table>  
										
									</div>					
							</td></tr>
							</table>	
							
							<table style="width: 200px;margin: auto;">
								<tr>
									<td style="vertical-align: top;text-align: left;">
										<input type="submit" class="button add-answer-icon ui-corner-all ui-state-default"  value="Đồng ý">
									</td>
									<?php if($this->ObjQuestion['isupdate']==1){ ?>
									<td style="vertical-align: top;text-align: left;">
										<input type="button" onclick="window.close()" value="Hủy bỏ" class="button add-answer-icon ui-corner-all ui-state-default"> 
									</td>
									<?php } else { ?>
									<td style="vertical-align: top;text-align: left;">
										<input  type="button" value="Hủy bỏ" onclick="window.location='<?php echo  BASE_URL.'/question';  ?>'" style="font-size: 15px;" class="add-answer-icon ui-state-default ui-corner-all"> 
									</td>
									<?php }  ?>
								</tr>
							</table>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>


<script type="text/javascript">
$(document).ready(function(){			
			$("#subject_id").change(function(){			
			var subject_id = $("#subject_id").val();
                        
                        $(".cms_table").block({
                                message: '<span><b>Đang xử lý...</b></span>',                 
                        overlayCSS:  {  
                            '-webkit-border-radius': '3px', 
                            '-moz-border-radius':    '3px',	
                            'padding-bottom': '3px',
                            backgroundColor: '#fff'
                        }
                        });     
                        
			 $.ajax({
			   type: "POST",
			   url: $("#BASE_URL").val()+"/chaptersubject/ajaxgetchaptersubject"+"/token/"+fnGenToken(),
			   data: "subject_id="+subject_id,
			   dataType: "json",
			   success: function(data){
					if(data['success']==true){
                                                $(".chapter_id").html(data['sltChapterSubject']);
    						 }
    						 else
                                                alert("Có lỗi: "+data['error']); 
                                        $(".cms_table").unblock();	
    				}			      
			 });
			 
		});
});			
</script>

